﻿'use strict';

/* Directives */

angular.module('ishaCrmApp.directives', [])

    .directive('appVersion', ['version', function (version) {
        return function (scope, element, attrs) {
            element.text(version);
        };
    }])

    .directive('login', function () {

        var template = '<p class="navbar-text pull-right">' +
                        '<a href="#" ng-show="!signin" ng-click="login()" class="navbar-link">{{value || \'Sign In\'}}</a>' +
                        '<a href="#" ng-show="signin" ng-click="logout()" class="navbar-link">Logged in as {{full_name()}}</a>' +
                      '</p>';

        var definition = {
            restrict: 'E',
            replace: true,
            transclude: false,
            template: template
        };

        return definition;

    });